Insert numpy array to column

31

add column to existing numpy array -

b = np.insert(a, insert_index, values=a[:,2], axis=1)

add a new column to numpy array -

import numpy as np
N = 10
a = np.random.rand(N,N)
b = np.zeros((N,N+1))
b[:,:-1] = a

Comments

Submit
0 Comments